This invention relates to a method of storing regularly sampled data in a computer memory in such a way that recent data is represented in detail and older data is maintained in progressively less detail.
When a variable quantity is measured periodically, and a record of that variable quantity is maintained in a memory of limited size, it is common practice to discard the oldest samples in memory in order to make room for new samples, and thus maintain in memory a fixed number of equally-spaced samples. Such a recording technique provides data at a fixed sampling interval back to a particular point in time and no data beyond that point.
In this invention, the available memory is divided into a number of segments, and those segments are used for selectively storing the data, in such a way that a single, integrated record is obtained that represents recent data at a short sampling interval and older data at progressively longer sampling intervals.
Two embodiments of the invention are detailed herein. In the first embodiment, data samples are recorded into the various segments of memory as follows. Every other sample, starting with the first, is recorded into the first segment of memory. Every fourth sample, starting with the second, is recorded into the second segment of memory. Every eighth sample, starting with the fourth, is recorded into the third segment, and so on. The last segment is treated differently, so that it contains all of the samples that do not fall into any of the preceding segments. Any segment, when full, is overwritten from the start. Methods are described for addressing the necessary memory locations and for recovering sequential data from the memory. The same result could be achieved by maintaining a separate record in memory for each of several sampling intervals. The invention has the advantage of not requiring that any data samples be stored in more than one location.
The second embodiment of the invention is for creating a record whose elements will represent periods of time, such as maxima or averages. In such a case, the samples should be combined so that the samples represent longer periods of time as the data age. Again, the memory is divided into a number of segments. All data samples are written into the first segment. When that segment is full and its first entry is about to be overwritten, the first entry is combined with the second entry and the result is written into the second segment. When the third entry in the first segment is about to be overwritten, it is combined with fourth entry and recorded in the second location in the second segment. The process is the same for all subsequent entries in the first segment and for all subsequent segments, except that data from the last segment are lost when they are overwritten. As with the first embodiment, methods are described for addressing the necessary memory locations for recording and for accessing data samples to be combined, and methods are described for extracting data from the record.
An embodiment of the device for practicing the invention typically consists of a data recording device consisting of a signal input, one or more microprocessors, a memory unit, a push-button control input and a communications port for transmitting data to a host computer. The invention concerns the selection of data locations to which the data are to be recorded, methods of combining and re-recording previously-recorded data, and the method of re-ordering and interpreting the data once they have been transmitted to the host computer.
Definition of Terms
To facilitate the description of the invention, the following terminology will be used.
Sampling interval the period of time from one sample to the next. The period is typically one hour divided by an integral power of two.
Data sample one or more pieces of information recorded at a particular time. (In some cases, the data sample may be recorded over the sampling interval preceding the time associated with the data sample.)
Segment of memory one of several sections of memory. The samples within each segment of memory all represent equal sampling intervals. In the first and second embodiments described, the segments are of equal length.
Entry a number corresponding to the location of a data sample within a segment of memory. Reading number a number corresponding to a particular data sample.
Methods will be described for determining locations within memory at which data samples will be stored and for locating samples to be combined and determining the locations at which the combined samples will be stored. Methods will also be described by which the host computer will locate, within the data transferred from the logger, sequential samples of the recorded data, and by which the host computer will determine the times when the samples were taken.
In a first embodiment this invention features a method of saving data samples in a computer memory, the data samples representing data obtained over a period of time, and provided at a data input source, comprising: dividing computer memory into a plurality of memory segments, each said segment having a plurality of data memory locations; sequentially saving all data samples except those falling in an equally-spaced sequence into the first segment of memory, and recording all of those in that sequence into subsequent segments of memory.
This method may further include saving all of the samples in said equally-spaced sequence into the second segment of memory, except for those of that sequence falling into a second sequence of equally-spaced samples, a subset of the first sequence, and for each subsequent segment recording all samples not recorded in earlier segments except for an equally-spaced sequence of data samples, and then recording in the last segment all samples not recorded in previous segments.
The method may further include the refinement of the steps of saving data samples to the first, second and subsequent memory segments, the refinement including, when all memory locations in a segment are full, sequentially overwriting the data in the memory locations in the same sequence as before so that the oldest data in any memory segment is always the next to be overwritten. In another feature, the method may further include retrieving saved data organized in chronological order and calculating the time corresponding to each data sample.
In a second embodiment, the invention features a method of saving data samples in a computer memory, the data samples representing data obtained over a period of time, and provided at a data input source, comprising: dividing computer memory into a plurality of memory segments, each said segment having a plurality of data memory locations, the first segment having at least n memory locations; periodically obtaining data samples from the data input source; sequentially saving the first obtained data samples into the n memory locations of the first segment; combining two of the saved data samples, and saving the combination into a memory location of the second segment; and saving another later obtained data sample into the memory location of one of the combined data samples.
In this embodiment, the method may further include combining subsequent pairs of data samples in the first segment, writing the combined data sample into the second memory segment, and subsequently writing new data samples into the locations in the first memory segment from which the data samples were taken to be combined. The method may further include, when the memory locations in the second segment and any later segment except the last have been filled, combining data samples from that segment and writing them into the next available location in the next available segment. Further, the number of samples combined at any time may be an integer greater than two. Finally, combining two or more of the saved data samples may comprise averaging, taking a maximum, or taking the last of said data samples.